diff options
Diffstat (limited to 'app/[lng]/auth/reset-password/page.tsx')
| -rw-r--r-- | app/[lng]/auth/reset-password/page.tsx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/app/[lng]/auth/reset-password/page.tsx b/app/[lng]/auth/reset-password/page.tsx new file mode 100644 index 00000000..f49e5d86 --- /dev/null +++ b/app/[lng]/auth/reset-password/page.tsx @@ -0,0 +1,47 @@ +// app/[lng]/auth/reset-password/page.tsx + +import { redirect } from 'next/navigation'; +import { validateResetTokenAction } from '@/lib/users/auth/partners-auth'; +import InvalidTokenPage from '@/components/login/InvalidTokenPage'; +import ResetPasswordForm from '@/components/login/reset-password'; +import { getPasswordPolicy } from '@/lib/users/auth/passwordUtil'; + +interface Props { + searchParams: { token?: string }; +} + +export default async function ResetPasswordPage({ searchParams }: Props) { + const token = searchParams.token; + + // 토큰이 없는 경우 로그인 페이지로 리다이렉트 + if (!token) { + redirect('/partners'); + } + + // 서버에서 토큰 검증 + const tokenValidation = await validateResetTokenAction(token); + + // 토큰이 유효하지 않은 경우 + if (!tokenValidation.valid) { + return ( + <InvalidTokenPage + expired={tokenValidation.expired || false} + error={tokenValidation.error} + /> + ); + } + + // 패스워드 정책 로드 + const passwordPolicy = await getPasswordPolicy(); + + // 유효한 토큰인 경우 폼 표시 + return ( + <div className="min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8"> + <ResetPasswordForm + token={token} + userId={tokenValidation.userId!} + passwordPolicy={passwordPolicy} + /> + </div> + ); +}
\ No newline at end of file |
